package com.android.corestat.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

public class CSPrefs {
	
	/**
	 * compare Time
	 */
	private static final String ELAPSED_REAL_TIME = "elapsed_real_time";
	private static final String SIM_STATE = "sim_state";
	private static final String IMEI = "imei";
	
	public static void setElapsedRealTime(Context c, long time) {
		SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(c);
		sp.edit().putLong(ELAPSED_REAL_TIME, time).commit();
	}
	
	public static long getElapsedRealTime(Context c) {
		return PreferenceManager.getDefaultSharedPreferences(c).getLong(ELAPSED_REAL_TIME, 0);
	}
	
	public static void setSimState(Context c, boolean isSimIn) {
		SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(c);
		sp.edit().putBoolean(SIM_STATE, isSimIn).commit();
	}
	
	public static boolean getSimState(Context c) {
		return PreferenceManager.getDefaultSharedPreferences(c).getBoolean(SIM_STATE, false);
	}
	
	public static void setImei(Context c, String imei) {
		SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(c);
		sp.edit().putString(IMEI, imei).commit();
	}
	
	public static String getImei(Context c) {
		return PreferenceManager.getDefaultSharedPreferences(c).getString(IMEI, "");
	}
}
